package ysq.xyg.sys.model.po;

import lombok.NoArgsConstructor;

import lombok.Data;
import ysq.xyg.base.util.BaseConstant;
import ysq.xyg.base.util.BaseUtil;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;

/**
 * 系统管理-菜单实体类
 *
 * @author shengQiang yu
 * @date 2019-4-1 10:31:20
 */
@Data
@NoArgsConstructor
@Table(name = "xyg_sys_menu")
public class SysMenu implements Serializable{

	/**
     * 主键
     */ 
	@Id
	private String id;
	
	/**
     * 图标
     */ 
	@Column(name = "menu_icon")
	private String menuIcon;
	
	/**
     * 名称
     */ 
	@Column(name = "menu_name")
	private String menuName;
	
	/**
     * 菜单类型：1、目录，2、菜单，3、按钮
     */ 
	@Column(name = "menu_type")
	private String menuType;
	
	/**
     * 权限
     */ 
	@Column(name = "permission")
	private String permission;
	
	/**
     * 级别:1、一级，2、二级，3、三级
     */ 
	@Column(name = "menu_grade")
	private String menuGrade;
	
	/**
     * 菜单连接
     */ 
	@Column(name = "menu_url")
	private String menuUrl;
	
	/**
     * 菜单code
     */ 
	@Column(name = "menu_code")
	private String menuCode;
	
	/**
     * 父级id
     */ 
	@Column(name = "parent_id")
	private String parentId;
	
	/**
     * 排序
     */ 
	@Column(name = "sort")
	private String sort;
	
	/**
     * 删除标注:1、正常，2、删除
     */ 
	@Column(name = "remove_tag")
	private String removeTag;
	
	/**
     * 创建时间
     */ 
	@Column(name = "create_time")
	private Date createTime;
	
	/**
     * 创建人
     */ 
	@Column(name = "create_user")
	private String createUser;
	
	/**
     * 修改时间
     */ 
	@Column(name = "update_time")
	private Date updateTime;
	
	/**
     * 修改人
     */ 
	@Column(name = "update_user")
	private String updateUser;

	/**
	 * 父类菜单名称
	 */
	@Transient
	private String parentMenuName;
	public SysMenu(SysUser sysUser) {
		this.id= BaseUtil.uId();
		this.removeTag= BaseConstant.BASE_REMOVE_TAG_NORMAL;
		this.createTime = new Date();
		this.createUser = sysUser.getId();
		this.updateTime = new Date();
		this.updateUser = sysUser.getId();
	}
}